package com.yp.lession.services.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yp.lession.dao.TemployeesMapper;
import com.yp.lession.entity.Temployees;
import com.yp.lession.services.TemployeesServices;
import com.yp.lession.util.MyBatisUtils;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebFilter("/emp")
public class TemployeesServicesImpl extends HttpServlet {


    private TemployeesServices es = (TemployeesServices) new  TemployeesServicesImpl();
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String pi = request.getParameter("pageNum");
        int pageNum =pi == null ? 0 : Integer.valueOf(pi);
        PageInfo<Temployees> empByPage = es.getEmpByPage(pageNum,5);
        request.setAttribute("pi",empByPage);
        request.getRequestDispatcher("index.jsp").forward(request,response);
    }
}
